import {request }from '../plugins/request'

export const getArticle = (params) =>{
    console.log("all")
    return request({
        url:'/api/articles',
        method:'GET',
        params
    })
}

// 获取公共文章列表
export const getYourFeedArticles = params => {
    console.log("youre")
    return request({
      method: 'GET',
      url: '/api/articles/feed',
      params,
    })
  }

export const getTags = () =>{
    return request({
        url:'/api/tags',
        method:'GET'
    })
}



// 添加点赞
export const addFavorite = slug => {
  console.log(slug)
  return request({
    method: 'POST',
    url: `/api/articles/${slug}/favorite`
  })
}

// 取消点赞
export const deleteFavorite = slug => {
  return request({
    method: 'DELETE',
    url: `/api/articles/${slug}/favorite`
  })
}

export const getArticles = slug => {
  return request({
    method: 'GET',
    url: `/api/articles/${slug}`
  })
}

// 获取文章评论
export const getComments = slug => {
  return request({
    method: 'GET',
    url: `/api/articles/${slug}/comments`
  })
}